<?php

class Application_Form_SearchUserForm extends Zend_Form
{
    private $_nik;
    
    public function getNik()
    {
        $this->_nik = new Application_Model_Pegawai();
        $result = $this->_nik->getAllNik();
        $i=array();
        
        foreach($result as $result)
        {
            $i[] = $result['nik'];
        } 
        
        return $i;
    }        
     
    public function init()
    {
        $this->setMethod('post');
        
        $id_pegawai = new Zend_Form_Element_Hidden('id_pegawai');
        $id_pegawai->removeDecorator('HtmlTag')->removeDecorator('label');
        
        $nik = new ZendX_JQuery_Form_Element_AutoComplete('nik');
        $nik->setLabel('NIK')->setRequired()->setJQueryParams(array('source' => $this->getNik()));
        
        $nama_pegawai = new Zend_Form_Element_Text('nama_pegawai');
        $nama_pegawai->setLabel('Nama Pegawai')->setAttrib('disabled', true);
        
        $cari = new Zend_Form_Element_Submit('submit');
        $cari->setLabel('Cari');
        
        $ulang = new Zend_Form_Element_Reset('ulang');
        $ulang->setLabel('Ulang')->removeDecorator('DtDdWrapper');
        
        $this->addElements(array($nik,$nama_pegawai, $cari, $ulang, $id_pegawai));
    }


}

